<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>输出姓名和年龄案例</title>
</head>

<body>
  <script>
    // 1. 定义变量接收数据
    let uname = prompt('请输入您的姓名: ')
    let age = prompt('请输入您的年龄: ')

    // 2. 处理接收的数据
    let str = `大家好, 我叫${uname}, 今年${age}岁了`

    // 3. 往页面中写入数据
    document.write(str)

  </script>
</body>

</html>